package com.github.zzay.news.feign.factory;

import com.github.zzay.news.feign.NewsServiceClient;
import com.github.zzay.news.feign.fallback.NewsServiceClientFallbackImpl;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

/**
 * @author zzay
 * @className UserServiceClientFallbackFactory
 * @description User Service Client Fallback Factory
 * @create 2022/06/06 15:11
 */
@Component
public class NewsServiceClientFallbackFactory implements FallbackFactory<NewsServiceClient> {
    @Override
    public NewsServiceClient create(Throwable cause) {
        NewsServiceClientFallbackImpl newsServiceClientFallback = new NewsServiceClientFallbackImpl();
        newsServiceClientFallback.setThrowable(cause);
        return newsServiceClientFallback;
    }
}
